package com.guigu.xiaowenbo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.util.PageVo;
import com.guigu.xiaowenbo.mapper.ScellMapper;
import com.guigu.xiaowenbo.pojo.Scell;
import com.guigu.xiaowenbo.service.ScellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScellServiceImpl implements ScellService {
    @Autowired(required = false)
    ScellMapper scellMapper;
    public int insert(Scell scell){
        return scellMapper.insert(scell);
    }
    public PageVo selectByPrimaryKeyfh(Integer num, Integer size){
        PageHelper.startPage(num,size);
        List<Scell> list = scellMapper.selectByPrimaryKeyfh();
        PageInfo pageInfo  = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setRows(pageInfo.getList());
        pageVo.setTotal(pageInfo.getTotal());
        return pageVo;
    }
    public Scell selectByPrimaryKeyfhid(String storeid){
        return scellMapper.selectByPrimaryKeyfhid(storeid);
    }
    public int updateByPrimaryKeySelective(Scell scell){
        System.out.println(scell.getStoreid());
        return scellMapper.updateByPrimaryKeySelective(scell);
    }
    public PageVo selectByPrimaryKeyfhcx(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Scell> list = scellMapper.selectByPrimaryKeyfhcx();
        PageInfo pageInfo  = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setRows(pageInfo.getList());
        pageVo.setTotal(pageInfo.getTotal());
        return pageVo;
    }

    public int updateByPrimaryKeySelectivebg(Scell scell){
        return scellMapper.updateByPrimaryKeySelectivebg(scell);
    }

    public List<Scell> selectByPrimaryKeyid(String prouctid){
        return scellMapper.selectByPrimaryKeyid(prouctid);
    }

    public int updatesc(String prouctid, Integer amount){
        return scellMapper.updatesc(prouctid,amount);
    }
    public Scell selectByPrimaryKeyfhcxid(String prouctid){
        return scellMapper.selectByPrimaryKeyfhcxid(prouctid);
    }
    public int updatescrw(String prouctid, Integer amount){
        return scellMapper.updatescrw(prouctid,amount);
    }
    public Scell selectpid(String prouctid){
        return scellMapper.selectpid(prouctid);
    }

}
